package collage.SUBJECT.TYPE;

import java.util.Scanner;


public class SUBJECT_TYPE_Service implements ISUBJECT_TYPE_Service {

	SUBJECT_TYPE_DAO sdao = new SUBJECT_TYPE_DAO();
	
	@Override
	public void createSubject() {
		System.out.println( "과목유형정보 등록");
		
		Scanner sc = new Scanner(System.in);
		SUBJECT_TYPE_VO s = new SUBJECT_TYPE_VO();
		
		System.out.println( "과목유형번호를 입력해 주세요" );
		s.setSub_type_no( sc.next() );
	
		System.out.println( "과목유형이름을입력해 주세요" );
		s.setSub_type_name( sc.next() );
		
		
		if( sdao.insertSubject(s) ){
			System.out.println("정삭적으로 입력되었습니다.");
		}
		else{
			System.out.println( "눈 똑바로 안뜰래?" );
		}
		
	}

	@Override
	public void readSubject() {
	for ( SUBJECT_TYPE_VO s : sdao.selectSubject()){
		System.out.print( s.getType_tr() );
		System.out.print( " / ");
		System.out.print( s.getSub_type_no()  );
		System.out.print( " / ");
		System.out.println( s.getSub_type_name());
	
		}
	}

	@Override
	public void modifySubject() {

		SUBJECT_TYPE_VO s = new SUBJECT_TYPE_VO();
		System.out.println( "과목유형정보 수정");
		Scanner sc = new Scanner(System.in);
		
		System.out.println( "수정할 과목유형번호를 입력해 주세요");
		s.setSub_type_no( sc.next() );
		System.out.println( "수정하실 과목명을 입력해 주세요" );
		s.setSub_type_name( sc.next() );
		
		if( sdao.updateSubject(s) ){
			System.out.println("정삭적으로 입력되었습니다.");
		}
		else{
			System.out.println( "눈 똑바로 안뜰래?" );
		}
		
	}

	@Override
	public void removeSubject() {
		
		Scanner sc = new Scanner(System.in);
		SUBJECT_TYPE_VO s = new SUBJECT_TYPE_VO();
		
		System.out.println( "삭제할 과목유형번호를 입력해 주세요");
		s.setSub_type_no( sc.next() );
		
		if( sdao.deleteSubject(s) ){
			System.out.println("정삭적으로 삭제되었습니다.");
		}
		else{
			System.out.println( "눈 똑바로 안뜰래?" );
		}
	}

}
